﻿
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace WinnerCMS.Data.Mapping
{
    public partial class ShoppingCartMap
        : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<WinnerCMS.Model.ShoppingCart>
    {
        public ShoppingCartMap()
        {
            // table
            //ToTable("CMS_ShoppingCarts");

            // keys
            HasKey(t => t.Id);

            // Properties
            Property(t => t.Id)
                
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.GoodsId)
                
                .IsRequired();
            Property(t => t.Quantity)
                
                .IsRequired();
            Property(t => t.CartGUID)
                
                .HasMaxLength(50)
                .IsRequired();
            Property(t => t.CheckInDate)
                
                .IsRequired();
            Property(t => t.IsBundling)
                
                .IsRequired();

            // Relationships
            HasRequired(t => t.Shop)
                .WithMany(t => t.ShoppingCarts)
                .HasForeignKey(d => d.GoodsId);

            //InitializeMapping();
        }
    }
}

